package com.imyours.net.messagedisposer;

import java.util.HashMap;
import java.util.Map;

import net.sf.json.JSONObject;

import com.imyours.net.result.ExecuteResult;
import com.imyours.net.result.UserInfoResult;

public class MyInfoMessageDisposer extends MessageDisposer {

	public MyInfoMessageDisposer(ExecuteResult result, String text) {
		super(result, text);
	}

	@Override
	protected void execute(JSONObject jo) throws Throwable {
		JSONObject usero = jo.getJSONObject("user");
		UserInfoResult re = (UserInfoResult) result;
		Map<String, String> userInfoData = re.getUserInfoData();
		for (Object key : usero.keySet()) {
			userInfoData.put(key.toString(), usero.getString((String) key));
		}
		re.setSuccessed(true);
	}

}
